<template>
  <div id="video_container"></div>
</template>
<script>
export default {
  name: 'VideoPlayer',
  props: {
    url: {
      type: String,
      required: true,
      default: "",
    },
    width: {
      type: Number,
      required: false,
      default: 500
    },
    height: {
      type: Number,
      required: false,
      default: 500
    },
    isPlay:[String,Number]
  },
  mounted () {
    new this.TcPlayer('video_container', {
        m3u8:this.url,//请替换成实际可用的播放地址
        m3u8_h: this.url,
        m3u8_sd:this.url,
        autoplay: true,
        width: this.width,
        height: this.height,
        poster: "",
        continuePlay:true,
        ullscreenToggle:false,
        listener: function(msg) {

        }
    });
    if(this.isPlay=='0'){
      //禁止拖拽
      document.querySelector(".vcp-slider").style.pointerEvents ="none";
    }else{
      //启用拖动
      document.querySelector(".vcp-slider").style.pointerEvents ="auto";
    }
  }
}
</script>
